package com.ai.web.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ai.web.service.WxMenuService;
import com.ai.web.vo.WxMenuV;
import com.ai.web.vo.ResultModel;
import com.tiny.persistence.domain.WxRoleMenu;
import com.tiny.persistence.domain.WxMenu;
import com.tiny.persistence.repository.WxMenuRepo;

@Service
public class WxMenuServiceImpl extends BaseServiceImpl<WxMenu, Integer, WxMenuV> implements WxMenuService  {

    @Autowired
    private WxMenuRepo wxMenuRepo;
    
    @Autowired
    public WxMenuServiceImpl(WxMenuRepo wxMenuRepo) {
        super(wxMenuRepo);
    }

    public WxMenuV getWxMenu(int userId) throws Exception {
        return getT(userId);
    }

    public ResultModel saveWxMenu(WxMenuV wxMenuV) throws Exception {
        
        WxMenuV saveV = saveT(wxMenuV);
        
        ResultModel rm = new ResultModel();
        rm.setData(saveV);
        rm.setSuccessCode();
        
        return rm;
    }

    public ResultModel deleteWxMenus(List<Integer> userIds) throws Exception {
        deleteTs(userIds);
        
        ResultModel rm = new ResultModel();
        rm.setSuccessCode();
        rm.setMsg("删除成功！");
        
        return rm;
    }

	public List<WxMenu> findAllMenuList() {
		return wxMenuRepo.findAllMenuList();
	}

}
